package main

import "fmt"

type Vertex struct {
	Lat, Long float64
}

var mapV map[int]Vertex

func main() {
	fmt.Println("test map base")

	//mapS := make(map[string]string) // or
	var mapS map[string]string
	mapS = make(map[string]string)
	mapS["1"] = "1v"
	mapS["2"] = "2v"
	mapS["3"] = "3v"
	mapS["4"] = "4v"

	//*
	for key := range mapS {
		fmt.Println("key = ", key, ", value = ", mapS[key])
	}
	//*/

	mapVertex()
	fmt.Println(mapV)

	structVertex()
	point()
}

func mapVertex() {
	mapV = make(map[int]Vertex)
	mapV[1] = Vertex{
		50, 51,
	}

	for key := range mapV {
		fmt.Println("key = ", key, ", value = ", mapV[key])
	}

	//mapVL = make(map[int]Vertex)
}

func structVertex() {
	fmt.Println("sv", Vertex{1, 2})

	var structV Vertex
	//structV = Vertex{1, 2}
	structV.Lat = 1
	structV.Long = 2
	fmt.Printf("structV.Lat = %d\n", structV.Lat)
	fmt.Println("structV.Lat = ", structV.Lat)
	fmt.Println("structV = ", structV)
	fmt.Println(structV.Lat)
}

func point() {
	p := Vertex{1, 2}
	q := &p
	q.Lat = 11
	fmt.Println("q = ", q.Lat)

	var p2 *Vertex
	p2 = &p
	fmt.Println("p2 = ", p2)
	fmt.Println("*p2 = ", *p2)

}
